import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '项目名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '类目',
    align: 'center',
    dataIndex: 'type',
    customRender: ({ text }) => {
      return render.renderDict(text, 'nurse_type');
    },
  },
  {
    title: '机构编码',
    align: "center",
    dataIndex: 'sysOrgCode'
  },
  {
    title: '费用',
    align: "center",
    dataIndex: 'fee'
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'status'
  },
  {
    title: '排序',
    align: "center",
    dataIndex: 'sorts'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "项目名称",
    field: 'name',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "状态",
    field: 'status',
    component: 'Input',
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入项目名称!'},
             ];
    },
  },
  {
    label: '类目',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'nurse_type',
      placeholder: '请选择类目',
    },
  },
  {
    label: '费用',
    field: 'fee',
    component: 'InputNumber',
  },
  {
    label: '状态',
    field: 'status',
    component: 'Input',
  },
  {
    label: '排序',
    field: 'sorts',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  name: {title: '项目名称',order: 0,view: 'text', type: 'string',},
  type: {title: '类目',order: 1,view: 'list', type: 'string',dictCode: 'nurse_type'},
  sysOrgCode: {title: '机构编码',order: 2,view: 'text', type: 'string',},
  fee: {title: '费用',order: 3,view: 'number', type: 'number',},
  status: {title: '状态',order: 4,view: 'text', type: 'string',},
  sorts: {title: '排序',order: 5,view: 'text', type: 'string',},
};
